<?php

class ReferenciasView extends Referencias{
	
	public function listar($arr){
		$total = count($arr);
		for($i = 0;$i < $total;$i++){      	
			echo '<tr>';
				echo '<td width="10%">';
					echo '<img src="../class/thumb.php?img=../imagens/referencias/',$arr[$i]['imagem0'],'&w=100&h=80">';
				echo '</td>';
				echo '<td width="20%">',$arr[$i]['nome'],'</td>';
				echo '<td width="10%">',$arr[$i]['tamanho'],'</td>';
				echo '<td width="10%">',$arr[$i]['cor'],'</td>';
				echo '<td width="10%">',$arr[$i]['quantidade'],'</td>';
				echo '<td width="20%" align="center" onclick="javascript:editar(',$arr[$i]['idreferencias'],',\'referencias\');" class="tabelaB"><img src="images/app-edit-icon.png" width="20" align="absmiddle" /> Editar</td>';
				echo '<td width="20%" id="editar" align="center" onclick="javascript:excluir(',$arr[$i]['idreferencias'],',\'Referencias\');" class="tabelaB"><img src="images/app-delete-icon.png" width="20" align="absmiddle" /> Excluir</td>';
			echo '</tr>';
	    }
	}
	public function visualizar($arr){
		$total = count($arr);
		for($i = 0;$i < $total;$i++){
			echo '<tr>';
				if($arr[$i]['quantidade'] > 0){
					echo '<td width="10">';
						echo '<input type="radio" name="ref" title="',$arr[$i]['cor'],'" value="',$arr[$i]['idreferencias'],'" />';
					echo '</td><td>';
						echo $arr[$i]['cor'];
					echo '</td>';
				}else{
					echo '<td>';
						echo '<input type="radio" name="ref" disabled="disabled" value="',$arr[$i]['idreferencias'],'" />';
					echo '</td><td>';
						echo $arr[$i]['cor'],'(indisponível no momento)';
					echo '</td>';
				}
			echo '</tr>';
		}
	}
	public function imagens($arr){
		$total = count($arr);
		if($total > 0){
			echo '<div id="imgcont">';
				echo '<img class="largeImg1" src="class/thumb.php?img=../imagens/referencias/',$arr[0]['imagem0'],'&w=320&h=320" alt="imagens/referencias/',$arr[0]['imagem0'],'" />';
			echo '</div>';
		}
		echo '<ul class="thumbsa">';
			for($j = 1;$j < $total;$j++){
				echo '<li><img class="largeImg1" style="background:url(class/thumb.php?img=../imagens/referencias/',$arr[$j]['imagem0'],'&w=150&h=150) no-repeat center;"
				src="imagens/transparente.png"  alt="imagens/referencias/',$arr[$j]['imagem0'],'" /></li>';
			}
		echo '</ul>';
	}
	public function tamanhos($arr){
		$total = count($arr);
		echo '<option>Selecione o tamanho</option>';
		for($j = 0;$j < $total;$j++){
			echo '<option value="',$arr[$j]['idreferencias'],'" >',$arr[$j]['tamanho'],'</option>';
		}
	}
}
?>